This page last changed on Mar 21, 2007 by aaime.
This is not for the faint of heart, and should not be needed in 1.5.0 onwards releases since we have a fallback system based on a property file. These instructions are here mainly for the curious that wants to know a little more about the EPSG database subsystem.
Since the implementation of the HSQL database in the WCS branch of Geoserver for storing EPSG projection codes,
specifying a custom projection is a bit more tricky than simply making an entry in the epsg.properties file.
To define my projection, I edited the EPSG.sql file. This file is used to create the cached EPSG database.
- Change into your geoserver/WEB-INF/lib directory
- Uncompress the gt2-epsg-h.jar file:
- Open the org/geotools/referencing/factory/epsg/EPSG.sql file with a text editor. To add a custom projection, these entries are essential:
- an entry in the EPSG_COORDINATEREFERENCESYSTEM table:
(41111,'WGC 84 / WRF Lambert',1324,'projected',4400,NULL,4326,20000,NULL,NULL,'US Nat. scale mapping.','Entered by Alex Petkov','Missoula Firelab WRF','WRF','2000-10-19','',1,0),
where:
1324 is the EPSG_AREA code that describes the area covered by my projection
4400 is the EPSG_COORDINATESYSTEM code for my projection
20000 is the EPSG_COORDOPERATIONPARAMVALUE key for the array that contains my projection parameters
- an entry in the EPSG_COORDOPERATIONPARAMVALUE table:
(20000,9802,8821,40,'',9102), (20000,9802,8822,-97.0,'',9102), (20000,9802,8823,33,'',9110), (20000,9802,8824,45,'',9110), (20000,9802,8826,0.0,'',9001), (20000,9802,8827,0.0,'',9001)
here 9802 is the EPSG_COORDOPERATIONMETHOD key for the Lambert Conic Conformal (2SP) formula
- an entry in the EPSG_COORDOPERATION table:
(20000,'WRF Lambert','conversion',NULL,NULL,'',NULL,1324,'Used for weather forecasting.',0.0,9802,NULL,NULL,'Used with the WRF-Chem model for weather forecasting','Firelab in Missoula, MT','EPSG','2005-11-23','2005.01',1,0)
where
1324 is the EPSG_AREA code that describes the area covered by my projection
9802 is the EPSG_COORDOPERATIONMETHOD key for the Lambert Conic Conformal (2SP) formula
- Observe the commas. If you enter a line that is at the end of an INSERT statement, the comma is omitted (make sure the row before that has a comma at the end).
Otherwise, add a comma at the end of your entry. After all edits, save the file and exit.
- Compress the gt2-epsg-h.jar file:
jar -Mcvf gt2-epsg-h.jar META-INF org
- Remove the cached copy of the EPSG database, so that can be recreated. On my Linux machine, it resides in my /tmp directory:
rm -rf /tmp/Geotools/Databases/HSQL
- Restart Geoserver
Hopefully now the new projection will be successfully parsed. To verify that indeed my work succeeded, I listed the recognized projections by going to http://localhost:8080/geoserver/srsHelp.do
Here is the reported entry for my projection in the browser:
!projection.png!
|